import http from "@/api";
import { ResPage } from "@/api/interface";
import {
  ApiSysUserCreate,
  ApiSysUserDelete,
  ApiSysUserExport,
  ApiSysUserImport,
  ApiSysUserImportTemplateFile,
  ApiSysUserSearch,
  ApiSysUserUpdate,
  ApiSysUserUpdatePwd
} from "@/api/apis/sys_user";
import { dtoSysUserCreate, dtoSysUserDelete, dtoSysUserInfo, dtoSysUserUpdate } from "@/api/dbdto/dtoSysUser";
import { ReqSearch } from "@/api/interface/Search/ReqSearch";
import { DtoSysUserUpdatePwd } from "@/api/interface/SysUser/DtoSysUserUpdatePwd";

export const requestSysUserCreate = (params: dtoSysUserCreate) => {
  return http.post(ApiSysUserCreate, params);
};

export const requestSysUserSearch = (params: ReqSearch) => {
  return http.post<ResPage<dtoSysUserInfo>>(ApiSysUserSearch, params);
};

export const requestSysUserUpdate = (params: dtoSysUserUpdate) => {
  return http.post(ApiSysUserUpdate, params);
};

export const requestSysUserDelete = (params: dtoSysUserDelete) => {
  return http.post(ApiSysUserDelete, params);
};

export const requestSysUserImport = (params: dtoSysUserDelete) => {
  //导入数据
  return http.post(ApiSysUserImport, params);
};
export const requestSysUserTemplateFile = (params = {}) => {
  //导入数据,记得是download方法， md，使用post搞了半天
  return http.download(ApiSysUserImportTemplateFile, {});
};

export const requestSysUserExport = (params: ReqSearch) => {
  //导入数据
  return http.download(ApiSysUserExport, params);
};

export const requestSysUserUpdatePwd = (params: DtoSysUserUpdatePwd) => {
  return http.post(ApiSysUserUpdatePwd, params);
};
